package ipebg.mzk.facade.entity;

import org.hibernate.annotations.GenericGenerator;

import javax.persistence.*;

import java.io.Serializable;
import java.util.Date;

/**
 * Created by LT on 2016/4/18.
 */
@Entity
@Table(name = "TB_COMMON_TOKEN", schema = "", catalog = "")
public class TokenEntity  implements Serializable{
    private String tokenId;
    private int enable;
    private Date validDt;
    private String empNo;

    @Id
    @GenericGenerator(name = "hibernate-uuid", strategy = "uuid")
    @GeneratedValue(generator = "hibernate-uuid")
    @Column(name = "TOKEN_ID")
    public String getTokenId() {
        return tokenId;
    }

    public void setTokenId(String tokenId) {
        this.tokenId = tokenId;
    }

    @Basic
    @Column(name = "ENABLE")
    public int getEnable() {
        return enable;
    }

    public void setEnable(int enable) {
        this.enable = enable;
    }

    @Basic
    @Column(name = "VALID_DT")
    public Date getValidDt() {
        return validDt;
    }

    public void setValidDt(Date validDt) {
        this.validDt = validDt;
    }

    @Basic
    @Column(name = "EMP_NO")
    public String getEmpNo() {
        return empNo;
    }

    public void setEmpNo(String empNo) {
        this.empNo = empNo;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        TokenEntity that = (TokenEntity) o;

        if (enable != that.enable) return false;
        if (tokenId != null ? !tokenId.equals(that.tokenId) : that.tokenId != null) return false;
        if (validDt != null ? !validDt.equals(that.validDt) : that.validDt != null) return false;
        if (empNo != null ? !empNo.equals(that.empNo) : that.empNo != null) return false;

        return true;
    }

    @Override
    public int hashCode() {
        int result = tokenId != null ? tokenId.hashCode() : 0;
        result = 31 * result + enable;
        result = 31 * result + (validDt != null ? validDt.hashCode() : 0);
        result = 31 * result + (empNo != null ? empNo.hashCode() : 0);
        return result;
    }
}
